{% extends 'base.html' %}
{% block title %}首页{% endblock %}


{% block main %}
    <main class="container rounded bg-white p-3">
        <h3>博客列表</h3>

        <div class="row row-cols-2 row-gap-3">
            {% for blog in blogs %}
                <div-col>
                    <div class="card">
                        <div class="card-header">
                            <a href="{% url 'blog:blog_detail' blog_id=blog.id %}">{{ blog.title }}</a>
                        </div>
                        <div class="card-body" style="height: 100px;">
                            <h5 class="card-title">{{ blog.content|striptags|truncatechars:15 }}</h5>

                        </div>
                        <div class="card-footer text-muted d-flex justify-content-between">
                            <div>
                                <img src="{% static 'img/1.jpg' %}" height="30" width="30" class="rounded-circle">
                                {{ blog.author.username }}
                            </div>
                            <div>
                                {{ blog.created_at|date:'Y-m-d h:i' }}
                            </div>
                        </div>
                    </div>
                </div-col>

            {% endfor %}
        </div>

    </main>
{% endblock %}
</main>
